<template>
    <div>
        <div><input v-model="name"></div>
        <div><input v-model="password"></div>
        <p>{{ tip }}</p>
    </div>
</template>
<script>
import{ref,  watch } from "vue"
export default{
    setup(){
        const name = ref("");
        const password = ref("");
        const tip = ref("提示");

        watch(password, (newValue, oldValue) =>{
            if (newValue.length<6){
                tip.value="密码过短"
            }else{
                tip.value=""
            }
        })
        return{
            name,
            password,
            tip
        }
    }
}
</script>

<style></style>